import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ColumnListHandler;
import org.junit.Test;

import java.sql.SQLException;
import java.util.List;

public class Dao {
    private static ComboPooledDataSource ds=new ComboPooledDataSource();
    private static QueryRunner qr=new QueryRunner(ds);

    public static List<Object> getStudentList(String name) {
        List<Object> list = null;
        try {
            list = qr.query("select sname from student where sname like '%"+name+"%'", new ColumnListHandler());
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return list;
    }

    @Test
    public void t(){
        List<Object> studentList = getStudentList("z");
        studentList.forEach(System.out::println);
    }
}
